package com.opencart.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.opencart.dao.CategoryDAO;
import com.opencart.domain.Category;
import com.opencart.service.CategoryService;
import com.opencart.utils.web.pagination.PagedResultSet;
import com.opencart.utils.web.pagination.Pager;

@Service("categoryService")
public class CategoryServiceImpl implements CategoryService {
	@Autowired
	private CategoryDAO categoryDAO;

	public CategoryDAO getCategoryDAO() {
		return categoryDAO;
	}

	public void setCategoryDAO(CategoryDAO categoryDAO) {
		this.categoryDAO = categoryDAO;
	}

	public Category findById(Long id) {
		return this.getCategoryDAO().findById(id);
	}

	public Category saveOrUpdate(Category category) {
		return this.getCategoryDAO().saveOrUpdate(category);
	}

	public PagedResultSet paginate(Pager pager) {
		return this.categoryDAO.paginate(pager);
	}

	public List<Category> findAll(Pager pager) {
		return this.categoryDAO.findAll(pager);
	}

	public Integer getAllCount() {
		return this.categoryDAO.getAllCount();
	}

	public List<Category> findAll() {
		return this.getCategoryDAO().findAll();
	}

	public void delete(Category category) {
		this.getCategoryDAO().delete(category);
	}

}
